import {createRouter, createWebHistory} from "vue-router";
import Home from "@/components/Home.vue";
import News from "@/components/News.vue";
import About from "@/components/About.vue";
import Detail from "@/components/Detail.vue";

const router = createRouter({
        history: createWebHistory(),
        routes: [
            {
                name: 'shouye',
                path: '/home',
                component: Home
            },
            {
                name: 'xinwen',
                path: '/news',
                component: News,
                children: [
                    {
                        name: 'xiang',
                        path: 'detail/:id/:title/:content?',  // ？代表可传可不传
                        component: Detail
                    }
                ]
            },
            {
                name: 'guanyu',
                path: '/about',
                component: About
            }
        ]
    }
)

export default router
